276A Lunch Rush codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int n,k,i,f,t;
cin>>n>>k;
vector<int> v(n);
for(i=0;i<n;i++)
{
int r;
cin>>f>>t;
if(t>k)
{
r=f-(t-k);
}
else r=f;
v[i]=r;
}
sort(v.rbegin(),v.rend());
cout<<v[0]<<endl;
return 0;
}
0 Comments